package cn.wolfcode.luowowo.acticle.service.impl;

import cn.wolfcode.luowowo.acticle.domain.Commodity;
import cn.wolfcode.luowowo.acticle.mapper.CommodityMapper;
import cn.wolfcode.luowowo.acticle.service.ICommodityService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class CommodityServiceImpl implements ICommodityService {

    @Autowired
    private CommodityMapper commodityMapper;


    public List<Commodity> list() {
        return commodityMapper.selectAll();
    }

    public void updateNumber(Long id) {
        commodityMapper.updateNumberByPrimaryKey(id);
    }

    public List<Commodity> selectUserOwnedGoodsById(Long id) {
        return commodityMapper.selectUserOwnedGoodsById(id);
    }

    public int selectUserIsOwenGood(Long cid,Long uid) {
        return commodityMapper.selectUserIsOwenGood(cid,uid);
    }

    public void insertRelation(Long uid, Long cid) {
        commodityMapper.insertRelation(uid,cid);
    }
}
